<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 你可以工作的最大周数 -->
    <script>
      var numberOfWeeks = function (milestones) {
        let sum = milestones.reduce((a, b) => a + b)
        let max = Math.max(...milestones)
        if (max > Math.floor(sum / 2)) {
          return (sum - max) * 2 + 1
        }
        return sum
      }
      console.log(numberOfWeeks([1, 2, 3]))
    </script>
  </body>
</html>
